package com.feicheng.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.feicheng.entity.Warehouse;
import com.feicheng.model.UserAndWarehouse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhennan.liu
 * @since 2022-07-04
 */
@Repository
@Mapper
public interface WarehouseMapper extends BaseMapper<Warehouse> {

    /**
     * 通过仓库管理员id查询仓库id
     * @author zhennan.liu
     * @param userId
     * @return
     */
    @Select("select warehouse_id from warehouse where user_id = #{userId}")
    Integer selectByid(@Param("userId") Integer userId);





    /**
     * 通过查询条件查询仓库列表，分页
     * @author lu.yu
     * @param pageInfo
     * @param wrapper
     * @return
     */
    Page<UserAndWarehouse> selectByPage(Page<UserAndWarehouse> pageInfo,
                                        @Param(Constants.WRAPPER) Wrapper wrapper);







}
